$(function(){
	var a = GetRequest();
	var id = a['id'];
	
	$.ajax({
		url:"FloatingPopulation/details",
		data:{id:id},
		dataType:"JSON",
		type:"POST",
		success:function(data){
			//个人信息姓名
			if(data.User!=null){
				$("#name").val(data.User.name);
				//曾用名
				$("#formerName").val(data.User.formername);
				//性别
				if(data.User.gender=="1"){
					$("#gender").val("男");
				}else if(data.User.gender=="0"){
					$("#gender").val("女");
				}else{
					$("#gender").val("");
				}
				//民族
				$("#national").val(data.User.national);
				//来本地的时间
				$("#localtimes").val(data.User.localtime);
				//公民身份证号
				$("#citizenshipnumber").val(data.User.citizenshipnumber);
				//户籍地址1省
				if(data.User.live!=null){
					if(data.User.live.address_province!=null){
						$("#province").val(data.User.live.address_province.name);
					}
					//户籍地址1市
					if(data.User.live.address_city!=null){
						$("#city").val(data.User.live.address_city.name);
					}
					//户籍地址1县
					if(data.User.live.address_county!=null){
						$("#county").val(data.User.live.address_county.name);
					}
					//户籍地址1乡
					$("#township").val(data.User.live.township);
					//户籍地址1村
					$("#village").val(data.User.live.village);
					//户籍地址1户
					$("#gates").val(data.User.live.gates);
				}
				if(data.User.live2!=null){
					//现住地址2省
					if(data.User.live2.address_province!=null){
						$("#province2").val(data.User.live2.address_province.name);
					}
					//现住地址2市
					if(data.User.live2.address_city!=null){
						$("#city2").val(data.User.live2.address_city.name);
					}
					//现住地址2县
					if(data.User.live2.address_county!=null){
						$("#county2").val(data.User.live2.address_county.name);
					}
					//现住地址2乡
					$("#township2").val(data.User.live2.township);
					//现住地址2村
					$("#village2").val(data.User.live2.village);
					//现住地址2户
					$("#gates2").val(data.User.live2.gates);
				}
				//固定电话
				$("#fixedtelephone").val(data.User.fixedtelephone);
				//移动电话
				$("#mobilephone").val(data.User.mobilephone);
				//紧急联系人
				$("#emergencycontact").val(data.User.emergencycontact);
				//紧联系人的固定电话
				$("#emergencycontactfixedtelephone").val(data.User.emergencycontactfixedtelephone);
				//紧急联系人的移动电话
				$("#emergencycontactmobilephone").val(data.User.emergencycontactmobilephone);
				//身高
				$("#height").val(data.User.height);
				//体重
				$("#weight").val(data.User.weight);
				//血型
				if(data.User.bloodtype!=null){
					$("#bloodtypeid").val(data.User.bloodtype.name);
				}
				//文化程度
				if(data.User.culture!=null){
					$("#cultureid").val(data.User.culture.name);
				}
				//宗教信仰
				if(data.User.religious!=null){
					$("#religiousId").val(data.User.religious.name);
				}
				//政治面貌
				if(data.User.face!=null){
					$("#faceid").val(data.User.face.name);
				}
				//健康状况
				if(data.User.health!=null){
					$("#healthid").val(data.User.health.name);
				}
				//从业状况
				if(data.User.workingconditions!=null){
					$("#workingconditionsid").val(data.User.workingconditions.name);
				}
				//婚姻状况
				if(data.User.maritalstatus!=null){
					$("#maritalstatusid").val(data.User.maritalstatus.name);
				}
			}	
			//配偶信息 姓名
			if(data.User.spouse!=null){
				$("#nameSpouse").val(data.User.spouse.name);
				//配偶身份证号
				$("#identitynumber").val(data.User.spouse.identitynumber);
				//户籍地址3省
				if(data.User.spouse.live!=null){
					if(data.User.spouse.live.address_province!=null){
						$("#province3").val(data.User.spouse.live.address_province.name);
					}
					//户籍地址3市
					if(data.User.spouse.live.address_city!=null){
						$("#city3").val(data.User.spouse.live.address_city.name);
					}
					//户籍地址3县
					if(data.User.spouse.live.address_county!=null){
						$("#county3").val(data.User.spouse.live.address_county.name);
					}
					//户籍地址3乡
					$("#township3").val(data.User.spouse.live.township);
					//户籍地址3村
					$("#village3").val(data.User.spouse.live.village);
					//户籍地址3户
					$("#gates3").val(data.User.spouse.live.gates);
				}
				//从业状况
				if(data.User.spouse.workingconditions!=null){
				$("#workingcond").val(data.User.spouse.workingconditions.name);
				}
				//工作单位
				$("#workunits").val(data.User.spouse.workunits);
				//本人联系电话
				$("#contactnumber").val(data.User.spouse.contactnumber);
			}
			//同住家庭成员信息
			if(data.User.family[0]!=null){
				if(data.User.family[0].relationship!=null){
					$("#betweenId1").val(data.User.family[0].relationship.between);
				}
				$("#citizenship1").val(data.User.family[0].citizenship);
				$("#nameFamily1").val(data.User.family[0].name);
				if(data.User.family[0].gender=="1"){
					$("#genderFamily1").val("男");
				}else if(data.User.family[0].gender=="0"){
					$("#genderFamily1").val("女");
				}else{
					$("#genderFamily1").val("");
				}
				$("#birth1").val(data.User.family[0].birthtime.substring(0,10));
				if(data.User.family[0].certificate=="1"){
					$("#certificate1").val("有");
				}else if(data.User.family[0].certificate=="0"){
					$("#certificate1").val("无");
				}else{
					$("#certificate1").val("");
				}
				if(data.User.family[0].thisCity=="1"){
					$("#thisCity1").val("是");
				}else if(data.User.family[0].thisCity=="0"){
					$("#thisCity1").val("否");
				}else{
					$("#thisCity1").val("");
				}
			}
			if(data.User.family[1]!=null){
				if(data.User.family[1].relationship!=null){
					$("#betweenId2").val(data.User.family[1].relationship.between);
				}
				$("#citizenship2").val(data.User.family[1].citizenship);
				$("#nameFamily2").val(data.User.family[1].name);
				if(data.User.family[1].gender=="1"){
					$("#genderFamily2").val("男");
				}else if(data.User.family[1].gender=="0"){
					$("#genderFamily2").val("女");
				}else{
					$("#genderFamily2").val("");
				}
				$("#birth2").val(data.User.family[1].birthtime);
				if(data.User.family[1].certificate=="1"){
					$("#certificate2").val("有");
				}else if(data.User.family[1].certificate=="0"){
					$("#certificate2").val("无");
				}else{
					$("#certificate2").val("");
				}
				if(data.User.family[1].thisCity=="1"){
					$("#thisCity2").val("是");
				}else if(data.User.family[1].thisCity=="0"){
					$("#thisCity2").val("否");
				}else{
					$("#thisCity2").val("");
				}
			}
			if(data.User.family[2]!=null){
				if(data.User.family[1].relationship!=null){
					$("#betweenId3").val(data.User.family[2].relationship.between);
				}
				$("#citizenship3").val(data.User.family[2].citizenship);
				$("#nameFamily3").val(data.User.family[2].name);
				if(data.User.family[2].gender=="1"){
					$("#genderFamily3").val("男");
				}else if(data.User.family[2].gender=="0"){
					$("#genderFamily3").val("女");
				}else{
					$("#genderFamily3").val("");
				}
				$("#birth3").val(data.User.family[2].birthtime);
				if(data.User.family[2].certificate=="1"){
					$("#certificate3").val("有");
				}else if(data.User.family[2].certificate=="0"){
					$("#certificate3").val("无");
				}else{
					$("#certificate3").val("");
				}
				if(data.User.family[2].thisCity=="1"){
					$("#thisCity3").val("是");
				}else if(data.User.family[2].thisCity=="0"){
					$("#thisCity3").val("否");
				}else{
					$("#thisCity3").val("");
				}
			}
			if(data.User.family[3]!=null){
				if(data.User.family[1].relationship!=null){
					$("#betweenId4").val(data.User.family[3].relationship.between);
				}
				$("#citizenship4").val(data.User.family[3].citizenship);
				$("#nameFamily4").val(data.User.family[3].name);
				if(data.User.family[3].gender=="1"){
					$("#genderFamily4").val("男");
				}else if(data.User.family[3].gender=="0"){
					$("#genderFamily4").val("女");
				}else{
					$("#genderFamily4").val("");
				}
				$("#birth4").val(data.User.family[3].birthtime);
				if(data.User.family[3].certificate=="1"){
					$("#certificate4").val("有");
				}else if(data.User.family[3].certificate=="0"){
					$("#certificate4").val("无");
				}else{
					$("#certificate4").val("");
				}
				if(data.User.family[3].thisCity=="1"){
					$("#thisCity4").val("是");
				}else if(data.User.family[3].thisCity=="0"){
					$("#thisCity4").val("否");
				}else{
					$("#thisCity4").val("");
				}
			}
			//计生信息
			if(data.User.marriage!=null){
				if(data.User.marriage.husband=="1"){
					$("#husband1").val("是");
				}else if(data.User.marriage.husband=="0"){
					$("#husband1").val("否");
				}else{
					$("#husband1").val("");
				}
				if(data.User.marriage.babyCertificate=="1"){
					$("#babyCertificate1").val("是");
				}else if(data.User.marriage.babyCertificate=="0"){
					$("#babyCertificate1").val("否");
				}else{
					$("#babyCertificate1").val("");
				}
				if(data.User.marriage.validation=="1"){
					$("#validation1").val("是");
				}else if(data.User.marriage.validation=="0"){
					$("#validation1").val("否");
				}else{
					$("#validation1").val("");
				}
				 $("#firstname").val(data.User.marriage.babyNumber);
				 $("#childrenWomen").val(data.User.marriage.childrenWomen);
				 $("#childrenMale").val(data.User.marriage.childrenMale);
				 if(data.User.marriage.policyIn=="1"){
					 $("#policyIn").val("2");
				 }else if(data.User.marriage.policyIn=="0"){
					 $("#policyIn").val("3");
				 }else{
					 $("#policyIn").val("");
				 }
				 if(data.User.marriage.policyOutside=="1"){
					 $("#policyOutside").val("2");
				 }else if(data.User.marriage.policyOutside=="0"){
					 $("#policyOutside").val("3");
				 }else{
						$("#policyOutside").val("");
				 }
				 if(data.User.marriage.certificate=="1"){
					 $("#certificate5").val("有");
				 }else if(data.User.marriage.certificate=="0"){
					 $("#certificate5").val("无");
				 }else{
						$("#certificate5").val("");
				 }
				 if(data.User.marriage.maintenance=="1"){
					 $("#maintenance").val("已缴费");
				 }else if(data.User.marriage.maintenance=="0"){
					 $("#maintenance").val("未缴费");
				 }else{
						$("#maintenance").val("");
				 }
				 if(data.User.marriage.pregnancy!=null){
					 $("#pregnancyId").val(data.User.marriage.pregnancy.pregnancy);
				 }
				 $("#measuress").val(data.User.marriage.measurestime.substring(0,10));
				 if(data.User.marriage.birth=="1"){
					 $("#birth5").val("男");
				 }else if(data.User.marriage.birth=="0"){
					 $("#birth5").val("女");
				 }else{
					 $("#birth5").val("");
				 }
				 $("#birthDates").val(data.User.marriage.birthDatetime.substring(0,10));
				 if(data.User.marriage.policy=="1"){
					 $("#policy").val("内");
				 }else if(data.User.marriage.policy=="0"){
					 $("#policy").val("外");
				 }else{
					 $("#policy").val("");
				 }
			}
			
			 //就业信息
			 if(data.User.employment!=null){
				 $("#employingUnitsName").val(data.User.employment.employingUnitsName);
				 if(data.User.employment.utit_type!=null){
					 $("#unitTypeId").val(data.User.employment.utit_type.unitTypeName);
				 }
				 if(data.User.employment.live!=null){
				 	 //户籍地址4省
					 if(data.User.employment.live.address_province!=null){
						 $("#province4").val(data.User.employment.live.address_province.name);
					 }
					 //户籍地址4市
					 if(data.User.employment.live.address_city!=null){
						 $("#city4").val(data.User.employment.live.address_city.name);
					 }
					 //户籍地址4县
					 if(data.User.employment.live.address_county!=null){
						 $("#county4").val(data.User.employment.live.address_county.name);
					 }
					//户籍地址4乡
					$("#township4").val(data.User.employment.live.township);
					//户籍地址4村
					$("#village4").val(data.User.employment.live.village);
					//户籍地址4户
					$("#gates4").val(data.User.employment.live.gates);
				 }
				 $("#institutionalCode").val(data.User.employment.institutionalCode);
				 $("#legalRepresentative").val(data.User.employment.legalRepresentative);
				 if(data.User.employment.serviceContract=="1"){
					 $("#serviceContract").val("1年");
				 }else if(data.User.employment.serviceContract=="2"){
					 $("#serviceContract").val("2年");
				 }else if(data.User.employment.serviceContract=="3"){
					 $("#serviceContract").val("3年");
				 }else if(data.User.employment.serviceContract=="4"){
					 $("#serviceContract").val("3年以上");
				 }else{
					 $("#serviceContract").val("");
				 }
				 $("#telephone").val(data.User.employment.telephone);
				 if(data.User.employment.insured!=null){
					 $("#insuredId").val(data.User.employment.insured.insuredType);
				 }
				 $("#socialSecurityNumber").val(data.User.employment.socialSecurityNumber);
				 $("#unitNumber").val(data.User.employment.unitNumber)
				 $("#wokerNumber").val(data.User.employment.wokerNumber);
				 if(data.User.employment.industry!=null){
					 $("#industryId").val(data.User.employment.industry.industryType);
				 }
				 if(data.User.employment.title!=null){
					 $("#titleId").val(data.User.employment.title.titleName);
				 }
				 if(data.User.employment.skill!=null){
					 $("#skillId").val(data.User.employment.skill.skillType);
				 }
				 $("#occupation").val(data.User.employment.occupation);
			 }
			 //居住信息
			 if(data.User.livinginformation !=null){
				 if(data.User.livinginformation.livepatten !=null){
					 $("#livepattenid").val(data.User.livinginformation.livepatten.livepatten);
				 }
				 if(data.User.livinginformation.livingreasons !=null){
					 $("#livingreasons").val(data.User.livinginformation.livingreasons.livingreasons);
				 }
				 if(data.User.livinginformation.housecategory !=null){
					 $("#housecategory").val(data.User.livinginformation.housecategory.housecategory);
				 }
				 if(data.User.livinginformation.houseleixing !=null){
					 $("#houseleixing").val(data.User.livinginformation.houseleixing.houseleixing);
				 }
				 if(data.User.livinginformation.usage !=null){
					 $("#usage").val(data.User.livinginformation.usage.usage);
				 }
				 if(data.User.livinginformation.live!=null){
					 //户籍地址5省
					 if(data.User.livinginformation.live.address_province!=null){
						 $("#province5").val(data.User.livinginformation.live.address_province.name);
					 }
					 //户籍地址5市
					 if(data.User.livinginformation.live.address_city!=null){
						 $("#city5").val(data.User.livinginformation.live.address_city.name);
					 }
					 //户籍地址5县
					 if(data.User.livinginformation.live.address_county!=null){
						 $("#county5").val(data.User.livinginformation.live.address_county.name);
					 }
					//户籍地址5乡
					$("#township5").val(data.User.livinginformation.live.township);
					//户籍地址5村
					$("#village5").val(data.User.livinginformation.live.village);
					//户籍地址5户
					$("#gates5").val(data.User.livinginformation.live.gates);
				 }
				 if(data.User.livinginformation.landlord!=null){
					 $("#housename").val(data.User.livinginformation.landlord.housename);
					 $("#telephone2").val(data.User.livinginformation.landlord.telephone);
					 $("#houseidcard").val(data.User.livinginformation.landlord.houseidcard);
					 if(data.User.livinginformation.landlord.qianshuzrs=="1"){
						 $("#qianshuzrs").val("是");
					 }else if(data.User.livinginformation.landlord.qianshuzrs=="2"){
						 $("#qianshuzrs").val("否");
					 }else{
						 $("#qianshuzrs").val("");
					 }
					 $("#agent").val(data.User.livinginformation.landlord.agent);
					 $("#agenttelephone").val(data.User.livinginformation.landlord.agenttelephone);
					 $("#agentidcard").val(data.User.livinginformation.landlord.agentidcard);
				 
					 if(data.User.livinginformation.landlord.agqianshuzrs=="1"){
						 $("#agqianshuzrs").val("是");
					 }else if(data.User.livinginformation.landlord.agqianshuzrs=="2"){
						 $("#agqianshuzrs").val("否");
					 }else{
						 $("#agqianshuzrs").val("");
					 }
				 }
				 $("#infomation").val(data.User.livinginformation.infomation);
			 }
		}
	})
	
	
	/**
	 * 通过路径获取id
	 * @returns
	 */
	function GetRequest() {
		var url = location.search; //获取url中"?"符后的字串
		var theRequest = new Object();
		 if (url.indexOf("?") != -1) {
	       var str = url.substr(1);
	       strs = str.split("&");
	       for (var i = 0; i < strs.length; i++) {
		       theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
		   }
		}
		return theRequest;
	}
})